﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DC2010.Tools;

namespace DC2010_Editor.Controls.Utils
{
    public partial class ListCreator : Form
    {
        public ListCreator(string result)
        {
            InitializeComponent();
            Result = result;

            richTextBox1.Text = result.Replace(";","\n");

            textBox1_TextChanged(null, null);
        }

        public string Result { get; set; }


        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string[] sItems = richTextBox1.Text.Split('\n');

            imageListBox1.Items.Clear();

            Result = "";

            foreach (string s in sItems)
            {
                string sOut = s.Replace(";", "");
                sOut = sOut.Replace("\n", "");

                ImageListBoxItem itm = new ImageListBoxItem(sOut);
                itm.Image = Properties.Resources.page;

                imageListBox1.Items.Add(itm);
                Result += sOut + ";";
            }

            Result = Result.Substring(0, Result.Length - 1);


        }
    }
}
